//
//  HNWithdrawCashHistoryCell.m
//  ZYManagementSystem
//
//  Created by 星道 on 17/6/24.
//  Copyright © 2017年 焕宁. All rights reserved.
//

#import "HNWithdrawCashHistoryCell.h"

@implementation HNWithdrawCashHistoryCell
{
    IBOutlet UILabel *_Time;
    IBOutlet UILabel *_Title;
    IBOutlet UILabel *_Price;
    IBOutlet UIView *_TopView;
    //全局单击手势，防止重复创建
    UITapGestureRecognizer *_Tap;
}

- (void)awakeFromNib
{
    [super awakeFromNib];

    //给详情View增加点击打开详情单击手势
    [_TopView addGestureRecognizer:[self TapIsHave]];
}



/**
 点语法
 */
- (void)setModel:(HNWithdrawCashHistoryModel *)Model
{
    _Model = Model;

    //时间
    _Time.text = Model.withdrawTime;
    //标题
    _Title.text = [self GetStrForIndex:[Model.withdrawFlag integerValue] Type:[Model.type integerValue] Num:[Model.num integerValue]];
    //总金额
    _Price.text = [NSString stringWithFormat:@"-%.2f",[Model.withdrawAmount doubleValue]];
}

/**
 提现状态 -1：未提现或暂不可提现 0：提现中，1：财务拒绝，2：财务同意，3：终审拒绝，4：终审同意，5：已结算 Type:0课程结算 1佣金金额
 当状态为-1时，判断Type的值，0显示未提现 1的话根据 num 值 ，2为未提现，1为暂不可提现
 */
- (NSString *)GetStrForIndex:(NSInteger)Index Type:(NSInteger)Type Num:(NSInteger)Num
{
    switch (Index)
    {
        //Index为-1
        case -1:
        {
            if (Type == 2)
            {
                return @"未提现";
            }
            else
            {
                if (Num == 0)
                {
                    return @"未提现";
                }
                else
                {
                    return @"暂不可提现";
                }
            }
        };break;
        case 0:return @"提现中";break;
        case 1:return @"财务拒绝";break;
        case 2:return @"财务同意";break;
        case 3:return @"终审拒绝";break;
        case 4:return @"终审同意";break;
        case 5:return @"已提现";break;
        default:return @"未知";break;
    }
}







/**
 打开详情
 */
- (void)OpenDetail
{
    //TopView详情添加打开详情事件
    self.ClickGoDetail (self.Model);
}


/**
  全局单击手势，防止重复创建
 */
- (UITapGestureRecognizer *)TapIsHave
{
    if (!_Tap)
    {
        _Tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(OpenDetail)];
    }
    return _Tap;
}
@end
